
import Vue from 'vue'
import App from './App'
import ElementUI from "element-ui";
import 'element-ui/lib/theme-chalk/index.css'
import router from './router'
import axios from "../node_modules/axios"
import store from './store'
import ThreeTable from 'vue-table-with-tree-grid'
import VueQuillEditor from "vue-quill-editor";//富文本编辑器


import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'

Vue.config.productionTip = false
Vue.use(ElementUI)
Vue.prototype.Element = ElementUI

axios.defaults.baseURL="http://127.0.0.1:8888/api/private/v1/"//设置默认值

//添加axios请求拦截器,获取token验证
axios.interceptors.request.use(config=>{
  config.headers.Authorization = window.sessionStorage.getItem('token');
  return config
})
//将axios挂载到vue原型上
Vue.prototype.$shop = axios
Vue.component('tree-table',ThreeTable);
Vue.use(VueQuillEditor)//注册富文本编辑器为全局
Vue.filter('dateFormat',function (originval){
  const dt = new Date(originval);
  const y = dt.getFullYear();
  const m = (dt.getMonth()+1+'').padStart(2,'0');
  const d = (dt.getDate()+'').padStart(2,'0');
  const hh = (dt.getHours()+'').padStart(2,'0');
  const mm = (dt.getMinutes()+'').padStart(2,'0');
  const ss = (dt.getSeconds()+'').padStart(2,'0');
  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
})
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  axios,
  components: { App },
  template: '<App/>'
}).$mount('#app')
